﻿namespace ManagementApi.Models
{
    /// <summary>
    /// 分页数据传输对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class PageDto<T>
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="items"></param>
        /// <param name="pageNum"></param>
        /// <param name="pageSize"></param>
        /// <param name="total"></param>
        /// <param name="duration"></param>
        public PageDto(IEnumerable<T> items, int pageNum, int pageSize, int total, double? duration)
        {
            List = items;
            Total = total;
            PageNum = pageNum;
            PageSize = pageSize;
            Duration = duration;
        }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageNum { get; set; }

        /// <summary>
        /// 每页数量
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总数量
        /// </summary>
        public int Total { get; set; }

        /// <summary>
        /// 查询耗时（毫秒）
        /// </summary>
        public double? Duration { get; set; }

        /// <summary>
        /// 数据集合
        /// </summary>
        public IEnumerable<T> List { get; set; }
    }
}